import 'package:encrypt/encrypt.dart';
import 'package:pointycastle/asymmetric/api.dart';

// rsa pkcs1 encrypt
String rsaEncrypt(String key, String data) {
  final publicKey = RSAKeyParser().parse(key) as RSAPublicKey;
  final encrypter = Encrypter(RSA(publicKey: publicKey));
  final encrypted = encrypter.encrypt(data);
  return encrypted.base64;
}
